<?php

// ===== Account Information ==============
$filekeen_login = ""; // Set your Filekeen Username
$filekeen_pass = "";  // Set your Filekeen Password
// =======================================

$not_done=true;
$continue_up=false;
if ($filekeen_login & $filekeen_pass){
    $_REQUEST['login'] = $filekeen_login;
    $_REQUEST['password'] = $filekeen_pass;
    $_REQUEST['action'] = "FORM";
    echo "<b><center>Use Default login/pass.</center></b>\n";
}
if ($_REQUEST['action'] == "FORM")
    $continue_up=true;
else
{
?>
	<table border=0 style="width:270px;" cellspacing=0 align=center>
		<form method=post>
			<input type=hidden name=action value='FORM' />
			<tr><td nowrap>&nbsp;Login*<td>&nbsp;<input type=text name=login value='' style="width:160px;" />&nbsp;</tr>
			<tr><td nowrap>&nbsp;Password*<td>&nbsp;<input type=password name=password value='' style="width:160px;" />&nbsp;</tr>
			<tr><td colspan=2 align=center><input type=submit value='Upload' /></tr>
			<tr><td colspan=2 align=center><small>*You can set it as default in <b><?php echo $page_upload["filekeen.com_member"]; ?></b></small></tr>
		</table>
	</form>
<?php
}

if ($continue_up){
		$not_done=false;
		
?>
<table width=600 align=center>
</td></tr>
<tr><td align=center>
<div id=login width=100% align=center>Login to Filekeen.com</div>
<?php
	if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
		$post['op'] = "login" ;
		$post['redirect'] = "" ;
		$post['login'] = $_REQUEST['login'];
		$post['password'] = $_REQUEST['password'];
		$post['x'] = "0" ;
		$post['y'] = "0" ;
		
		$page = geturl("filekeen.com", 80, "/login.html", 0, 0, $post, 0, $_GET["proxy"], $pauth);
		is_page($page);
		is_notpresent($page, 'HTTP/1.1 302 Moved', 'Error logging in - Are your logins correct?');
		preg_match_all('/Set-Cookie: (.*);/U',$page,$temp);
		$cookie = $temp[1];
		$cookies = implode(';',$cookie);
		$xfss=cut_str($cookies,'xfss=',' ');
	} else {
		echo "<br><b><center>Login not found, empty or using non member upload.</center></b>\n";
		$page = geturl("filekeen.com", 80, "/login.html");
		is_page($page);
		exit();
	}	

?>
<script>document.getElementById('login').style.display='none';</script>
<div id=info width=100% align=center>Retrive upload ID</div>
<?php
		$ref='http://filekeen.com/';
		$Url=parse_url($ref);
		$page = geturl($Url["host"], defport($Url), $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), 0, 0, 0, 0, $_GET["proxy"], $pauth);
		is_page($page);
		$upfrm = cut_str($page,'multipart/form-data" action="','upload.cgi?upload_id=');
		$uid = $i=0; while($i<12){ $i++;}
		$uid += floor(rand() * 10);
		$post['upload_type']= 'file';
		$post['sess_id']= $xfss;
		$post['srv_tmp_url']= $upfrm.'tmp';
		$post['file_0_descr']= '';
		$post['link_rcpt']='';
		$post['link_pass']='';
		$post['tos']='1';
		$post['submit_btn']=' Upload! ';
		$upurl= $upfrm.'upload.cgi?upload_id='.$uid.'&js_on=1&utype=reg&upload_type=file';
		$url=parse_url($upurl);
		
?>
<script>document.getElementById('info').style.display='none';</script>
<?php

	$upfiles=upfile($url["host"], defport($url), $url["path"].($url["query"] ? "?".$url["query"] : ""), $ref, $cookies, $post, $lfile, $lname, "file_0");
	
?>
<script>document.getElementById('progressblock').style.display='none';</script>
<?php
		$locat = cut_str($upfiles,'rea name=\'fn\'>','</textarea>');
		unset($post);
		$gpost['fn'] = $locat;
		$gpost['st'] = "OK";
		$gpost['op'] = "upload_result";
		$Url = parse_url($ref);
		$page = geturl($Url["host"], defport($Url), $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), $upurl, $cookies, $gpost, 0, $_GET["proxy"], $pauth);
		$ddl = cut_str($page,'<td><a href="','"');
		$download_link = $ddl;
	}

/****************************\
Written by Darkra 02/05/2011
\****************************/

?>